<?php defined('_JEXEC') or die('Restricted access'); // no direct access ?>
<ul class="menu" style="padding-left:0px;">
<?php 
jimport( 'joomla.application.application' );
        $db = &JFactory::getDBO();
$q = " SELECT m.id FROM #__menu as m"
	." WHERE m.link = 'index.php?option=com_properties&view=properties' ";	
	$db->setQuery($q);
	$Itemid = $db->loadResult();

$x=0;
$cid = JRequest::getVar('cid', 0, '', 'int');
$tid = JRequest::getVar('tid', 0, '', 'int');
//echo $list[1]->name;
foreach ($items as $item) { 
	$link 		= JRoute::_('index.php?option=com_properties&view=properties&cid='.$item->slug.'&Itemid='.$Itemid);
	$x++;
	if($cid == $item->id){
		$current='current active';
	}else{
		$current='';
	}
	$clase = 'level1 item'.$x.' '.$current;
?>
	<li class="<?php echo $clase; ?>">
		<a class="<?php echo $clase; ?>" href="<?php echo $link; ?>">
			<?php 
				if($cid == $x && $tid == 0){
					echo '<span style="color:#CD2B15;">'.$item->name.'</span>'; 
				}else{
					echo '<span>'.$item->name.'</span>'; 
				}
			?>
		</a>
	</li>
		<ul class="menu" style="padding-left:20px;">
	 <?php
	//if($cid == $item->id){		
		$i = 0;
		foreach ($Types as $type) { 
			$i++;
			$linkT = JRoute::_('index.php?option=com_properties&view=properties&cid='.$item->slug.'&tid='.$type->Tslug.'&Itemid='.$Itemid);			
	?>
			
			<li>
			<a style="margin-left:0px;" class="<?php echo $clase; ?>" href="<?php echo $linkT; ?>">
				<?php 
					if($tid == $i && $cid==$x){
						echo '<span style="color:#CD2B15;">'.$type->name.'</span>'; 
					}else{
						echo '<span>'.$type->name.'</span>'; 
					}
				?>
			</a>
			</li>
<?php 	} ?>
		</ul>
<?php 
	//} ?>
<?php 
} ?>
</ul>


		 


